package lvbu.wang.lvbuoperator.engine;

import lvbu.wang.lvbuoperator.constants.ConstantsValue;
import lvbu.wang.lvbuoperator.core.BaseActivity;
import lvbu.wang.lvbuoperator.core.App;

/**
 * Created by DaiQing.Zha on 2017/3/18 0018.
 */
public class CommServerConfig {

    /**
     * DEBUG：本地调试环境
     * TEST：测试环境
     * RELEASE：生产环境
     */
    public enum Mode {
        DEBUG, TEST, RELEASE
    }

    private static final String A_ROOT_DEBUG = "http://a.lvbu.co/";
    private static final String A_ROOT_TEST = "";
    private static final String A_ROOT_RELEASE = "http://a.lvbu.wang/";

    private static final String CDN_ROOT_DEBUG = "http://cdn.lvbu.co/";
    private static final String CDN_ROOT_TEST = "";
    private static final String CDN_ROOT_RELEASE = "http://cdn.lvbu.wang/";

    private static final String WSC_ROOT_DEBUG = "http://wsc.lvbu.co/";
    private static final String WSC_ROOT_TEST = "";
    private static final String WSC_ROOT_RELEASE = "http://wsc.lvbu.wang/";

    public static Mode USE_SERVER_MODE;
    static {
        int APP_VERSION = BaseActivity.getAppVersion(App.getInstance());
        if (APP_VERSION == ConstantsValue.APP_VERSION_SC) USE_SERVER_MODE = Mode.RELEASE;
        if (APP_VERSION == ConstantsValue.APP_VERSION_CS) USE_SERVER_MODE = Mode.DEBUG;
    }

    public static String getAServerRoot() {
        if (USE_SERVER_MODE == Mode.DEBUG) {
            return A_ROOT_DEBUG;
        } else if (USE_SERVER_MODE == Mode.TEST) {
            return A_ROOT_TEST;
        } else {
            return A_ROOT_RELEASE;
        }
    }
    public static String getCDNServerRoot() {
        if (USE_SERVER_MODE == Mode.DEBUG) {
            return CDN_ROOT_DEBUG;
        } else if (USE_SERVER_MODE == Mode.TEST) {
            return CDN_ROOT_TEST;
        } else {
            return CDN_ROOT_RELEASE;
        }
    }

    public static String getWscServerRoot() {
        if (USE_SERVER_MODE == Mode.DEBUG) {
            return WSC_ROOT_DEBUG;
        } else if (USE_SERVER_MODE == Mode.TEST) {
            return WSC_ROOT_TEST;
        } else {
            return WSC_ROOT_RELEASE;
        }
    }
}
